package Demo;

import java.util.Random;

public class Text {
    public static void main(String[] args) {
        Random random = new Random();
        //示例两辆坦克
        Tank tank1 = new Tank("坦克1",0,0);
        Tank tank2 = new Tank("坦克2",100,100);
        int i = 100;
        while(i > 0) {
            i--;
            int n = random.nextInt(10) + 1;//生随机成 1 - 10
            switch(n) {
                case 1:
                    tank1.shang();
                    break;
                case 2:
                    tank1.xia();
                    break;
                case 3:
                    tank1.zuo();
                    break;
                case 4:
                    tank1.you();
                    break;
                case 5:
                    tank1.fire();
                    break;
                case 6:
                    tank2.shang();
                    break;
                case 7:
                    tank2.xia();
                    break;
                case 8:
                    tank2.zuo();
                    break;
                case 9:
                    tank2.you();
                    break;
                case 10:
                    tank2.fire();
                    break;
            }
        }
        tank1.getCoordinate();
        tank1.getShell();
        tank2.getCoordinate();
        tank2.getShell();

    }
}
